﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AcadRibbon.Ribbons.Json.Model;

namespace AcadRibbon.Ribbons.Json.Serialize;
public static class RibbonJsonFactory
{
    public static RibbonTab CreateRibbonTab(this string title)
    {
        return new RibbonTab()
        {
            Id = Guid.NewGuid().ToString(),
            Name = $"{title}_Home",
            Title = title,
            IsActive = true,
        };
    }
    /// <summary>
    /// 创建面板
    /// </summary>
    /// <param name="ribbonTab"></param>
    /// <param name="title"></param>
    /// <returns></returns>
    public static RibbonPanel CreataeRibbonPanel(this RibbonTab ribbonTab, string title)
    {
        RibbonPanel ribbonPanel = new()
        {
            Id = Guid.NewGuid().ToString(),
            Source = new RibbonPanelSource()
            {
                Id = Guid.NewGuid().ToString(),
                Title = title,
                Name = title,
                IsEnabled = true,
                IsVisible = true,
            }
        };
        ribbonTab.Panels.Add(ribbonPanel);
        return ribbonPanel;
    }
}
